<template>
    <el-table-column label="操作" width="230" align="center">
        <template slot-scope="scope">
            <template v-if="scope.row.isDir!==true">
                <span class="link" @click="$emit('preview',scope.row)">浏览</span>
                <span @click="$emit('download-file',scope.row)" class="link">下载</span>
            </template>
            <template v-else>
                <span class="link" @click="$emit('open-dir',scope.row)">打开文件夹</span>
            </template>
            <span v-if="enableChangeFileMeta" class="link" @click="$emit('change-file-meta',scope.row)">修改</span>
            <span v-if="enableDelete" class="link" @click="$emit('delete',scope.row)">删除</span>
        </template>
    </el-table-column>
</template>

<script>
    export default {
        name: "FileOperatorColumn",
        props:{
            enableChangeFileMeta:{
                type:Boolean,
                default: true,
            },
            enableDelete:{
                type:Boolean,
                default: true,
            },
        }
    }
</script>

<style scoped>
    .link{
        color: #014FDE;
        cursor: pointer;
    }
    .link:hover{
        color: #409EFF;
        text-decoration: underline;
    }
</style>